package com.jemmyee.pizza.service;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jemmyee.core.dao.Page;
import com.jemmyee.pizza.dao.IUserDao;
import com.jemmyee.pizza.entity.User;

@Service("userService")
public class UserServiceImpl implements IUserService<User> {
	
	private static final Log log = LogFactory.getLog(UserServiceImpl.class);

	@Autowired
	private IUserDao userDao;


	public void delete(User entity) {
		userDao.delete(entity);
	}

	public void deleteById(Serializable id) {
		userDao.deleteById(id);
	}

	public User findById(Serializable id) {
		return userDao.findById(id);
	}

	public void save(User entity) {
		userDao.save(entity);
	}

	public void update(User entity) {
		userDao.update(entity);
	}

	public List<User> findAll(User entity) {
		return userDao.findAll(entity);
	}

	public Page findPageByCriteria(DetachedCriteria detachedCriteria,
			int pageSize, int startIndex,String order) {
		return userDao.findPageByCriteria(detachedCriteria, pageSize, startIndex, order);
	}

	public List<User> findByProperty(String propertyName,
			Object value) {
		return userDao.findByProperty(new User(), propertyName, value);
	}

	public List<User> findAll() {
		return userDao.findAll(new User());
	}

	public List<User> findByCriteria(DetachedCriteria criteria) {
		return userDao.findByCriteria(criteria);
	}

	/* (non-Javadoc)
	 * @see com.jemmyee.core.service.IBaseService#deleteAll(java.util.List)
	 */
	public void deleteAll(List<User> list) {
		// TODO Auto-generated method stub
		
	}
}
